#ifndef SIMPLE_SUPPORT_ITERATOR_OUT_OPTIONAL_HPP
#define SIMPLE_SUPPORT_ITERATOR_OUT_OPTIONAL_HPP

#include <utility> // std::forward

#include "out_filter.hpp" // out_filter
#include "out_transform.hpp" // out_transform

namespace simple::support
{

	template <typename It>
	auto out_optional(It it)
	{
		return out_filter([](auto&& x) { return static_cast<bool>(x); }, // out_truth
			out_transform([](auto&& x) -> decltype(auto) { return *std::forward<decltype(x)>(x); }, // out_deref
				it));
	}

} // namespace simple::support

#endif /* end of include guard */
